﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZhimeiSoft.CharmManager.Server.DAL
{
    public class CustomerDAL_Const
    {
        private static readonly string CUSTOMINFO_COLUMNS_WITHOUT_SALONID = @"CUSTOMERID, CNAME,CNICKNAME, CBIRTHDAY, CBIRTHDAYTYPE, CHEIGHT, CWIGHT,CMOBILEPHONE, 
                    CFAMLIYPHONE, CZIPCODE, CADDRESS, CINDEXCODE, CMAIL, CREGISTERDATE, CANCELDATE, CSTATE, CLASTREGISTERDATE, CLASTCALL, CMEMO, CONSTELLATORY, BLODDTYPE";

        private static readonly string CUSTOMINFO_COLUMNS = CUSTOMINFO_COLUMNS_WITHOUT_SALONID + ", SALONID";

        /// <summary>
        /// 插入
        /// </summary>
        public static readonly string SQL_INSERT_CUSTOMINFO = @"INSERT INTO CUSTOMINFO(CNAME, CBIRTHDAY, CBIRTHDAYTYPE, CHEIGHT, CWIGHT,CMOBILEPHONE, 
                    CFAMLIYPHONE, CZIPCODE, CADDRESS, CINDEXCODE, CMAIL, SALONID, CREGISTERDATE, CANCELDATE, CSTATE, CLASTREGISTERDATE, CLASTCALL, CMEMO, CNICKNAME, CONSTELLATORY, BLODDTYPE)
                VALUES (@CNAME,@CBIRTHDAY,@CBIRTHDAYTYPE,@CHEIGHT,@CWIGHT,@CMOBILEPHONE,@CFAMLIYPHONE,@CZIPCODE,@CADDRESS,@CINDEXCODE,@CMAIL,@SALONID,@CREGISTERDATE,@CANCELDATE
                    ,@CSTATE,@CLASTREGISTERDATE,@CLASTCALL,@CMEMO,@CNICKNAME, @CONSTELLATORY, @BLODDTYPE)";

        /// <summary>
        /// 修改
        /// </summary>
        public static readonly string SQL_UPDATE_CUSTOMINFO = @"UPDATE CUSTOMINFO  SET  CNAME = @CNAME 
                ,CBIRTHDAY = @CBIRTHDAY , CBIRTHDAYTYPE = @CBIRTHDAYTYPE, CHEIGHT = @CHEIGHT ,CWIGHT = @CWIGHT ,CMOBILEPHONE = @CMOBILEPHONE ,CFAMLIYPHONE = @CFAMLIYPHONE 
                 ,CZIPCODE = @CZIPCODE ,CADDRESS = @CADDRESS ,CINDEXCODE = @CINDEXCODE ,CMAIL = @CMAIL 
                 ,SALONID = SALONID ,CREGISTERDATE = @CREGISTERDATE ,CANCELDATE = @CANCELDATE ,CSTATE = @CSTATE 
                ,CLASTREGISTERDATE = @CLASTREGISTERDATE ,CLASTCALL = @CLASTCALL ,CMEMO = @CMEMO ,CNICKNAME = @CNICKNAME , CONSTELLATORY = @CONSTELLATORY, BLODDTYPE = @BLODDTYPE 
                WHERE CUSTOMERID = @CUSTOMERID";

        /// <summary>
        /// 删除
        /// </summary>
        public static readonly string SQL_DELETE_CUSTOMINFO = @"DELETE FROM CUSTOMINFO WHERE CUSTOMERID = @CUSTOMERID";
        /// <summary>
        /// 按照状态获取用户信息
        /// </summary>
        public static readonly string SQL_QUERY_CUSTOMINFO_STATE = string.Concat("SELECT ", CUSTOMINFO_COLUMNS_WITHOUT_SALONID, ", A.SALONID, B.SNAME AS SALONNAME FROM CUSTOMINFO A, SALONINFO B WHERE A.SALONID=B.SALONID AND A.CSTATE = @CSTATE");

        /// <summary>
        /// 查询所有用户信息
        /// </summary>
        public static readonly string SQL_QUERY_CUSTOMINFO = string.Concat("SELECT ", CUSTOMINFO_COLUMNS_WITHOUT_SALONID, ", A.SALONID, B.SNAME AS SALONNAME FROM CUSTOMINFO A, SALONINFO B WHERE A.SALONID=B.SALONID");

        /// <summary>
        /// 按照用户ID获取用户信息
        /// </summary>
        public static readonly string SQL_QUERY_CUSTOMINFO_ID = string.Concat("SELECT ", CUSTOMINFO_COLUMNS_WITHOUT_SALONID, ", A.SALONID, B.SNAME AS SALONNAME FROM CUSTOMINFO A, SALONINFO B WHERE A.SALONID=B.SALONID AND A.CUSTOMERID = @CUSTOMERID");
        /// <summary>
        /// 根据用户姓名获取信息
        /// </summary>
        public static readonly string SQL_QUERY_CUSTOMNAME = "SELECT * FROM CUSTOMINFO WHERE CNAME = @CNAME";
    }
}
